﻿<%@ page import="com.apexedu.framework.util.SysPropertiesUtil"%>
<%@ page import="com.apexedu.identity.IdConstants"%>
<%@ page import="com.apexedu.identity.entity.TSysMenu"%>
<%@ page import="com.apexedu.identity.entity.TSysUser"%>
<%@ page import="com.apexedu.identity.security.CasLoginUtil"%>
<%@ page import="com.apexedu.portal.constant.Constants"%>
<%@ page import="com.apexedu.portal.entity.TMessage"%>
<%@ page import="com.apexedu.util.StringUtil"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Random"%>
<%@ page import="com.apexedu.portal.entity.TLbxxMx"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -->
<%
	request.setAttribute("basePath", request.getContextPath());
	//String type = (String) request.getAttribute("type");
	//List<TSysMenu> mrfw = (List<TSysMenu>) request.getAttribute("mrfw");
	//List<TSysMenu> dyfw = (List<TSysMenu>) request.getAttribute("dyfw");
	//List<TMessage> todomessage = (List<TMessage>) request.getAttribute("todomessage");
	//List<TLbxxMx> message = (List<TLbxxMx>) request.getAttribute("message");
	//String todomessagenum = (String) request.getAttribute("todomessagenum");
	//TSysUser user = (TSysUser) request.getSession().getAttribute(IdConstants.SESSION_USER);
	Random rand = new Random();

	String casServerLogoutUrl = CasLoginUtil.getCasServerLogoutUrl();
	request.setAttribute("casServerLogoutUrl", casServerLogoutUrl);
%>
<html>
<head>
<title><%=Constants.ProjectInfo.PROJECT_NAME%></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,12,11,10,9,8" />
<link href="${basePath}/resources/css/mh.shmy.new.css" rel="stylesheet">
<script type="text/javascript" src="${basePath}/resources/ui/js/jquery-1.10.2.min.js"></script>
<script src="${basePath}/resources/js/mh.shmy.index.new.js" type="text/javascript"></script>
<script src="${basePath}/component/layer/layer.js" type="text/javascript"></script>

<script type="text/javascript">
		setInterval(function() {
			$.get("${basePath}/keepsession.jsp", {}, function(data) {
			});
		}, 60000); //每1分钟请求一次，保持session活动。

		var basePath = '${basePath}';
		function execLogout() {
			<%if (CasLoginUtil.isSsoEnabled()) {
				// 通知业务系统liveBos登出。
				// 这里的地址是根据项目现场业务系统地址在门户管理后台的系统参数维护里修改。参数名用“livebos.urls”
				String liveBosUrl = SysPropertiesUtil.get("livebos.urls");
				if (StringUtil.isNotBlank(liveBosUrl)) {
					String[] liveBosUrls = liveBosUrl.split(",");
					for (String url : liveBosUrls) {
						out.println("$(\"<iframe src='" + url
								+ "/logout.do' height='0' frameborder='0'/>\").appendTo(\"body\");");
					}
				}
			}%>
			$.get("${basePath}/identity/ajaxlogin.action?act=logout", {
				q : (new Date()).getTime()
			}, function(data) {
				data = eval("(" + data + ")");
				if (data.msg == 'success') {
					<%if (CasLoginUtil.isSsoEnabled()) {%>
						window.location.href = '${casServerLogoutUrl}';
					<%} else {%>
						window.location.href = "${basePath}" + "?t=" + Math.round(new Date / 1000);
					<%}%>
				} else {
					alert(data.msg);
				}
			});

		}
		function setTab(name, cursel, n, loa) {
			var url = "${basePath}" + "/s/uc/shmy/fdn/" + loa;
			$("#newsmore").attr('href', url);
			for (var i = 1; i <= n; i++) {
				var menu = document.getElementById(name + i);
				var con = document.getElementById("con_" + name + "_" + i);
				menu.className = i == cursel ? "hover" : "";
				con.style.display = i == cursel ? "block" : "none";
			}

		}
		function readMessage(messagewid, url, obj) {
			if (url == "") {
				layer.open({
					type : 2,
					title : '消息详情',
					shadeClose : true,
					shade : 0.8,
					area : [ '600px', '450px' ],
					content : '/s/m/detail/' + messagewid
				});
			} else {
				$.post("/s/m/read/" + messagewid, function(result) {
					window.open('${basePath}/s/uc/yw/index?url=' + url);
				});
			}

		}
	</script>
</head>
<body>


	<div id="main">
		<!--页头-->
		<div id="head">
			<span onclick="window.location.href='/'" class="titleSpan"></span>

			<div class="info">
				${user.username }&nbsp;&nbsp;&nbsp;&nbsp;
				<span class="mask"></span>

				<div class="headMenu" style="display: none;">
					<ul>
						<c:if test="${'admin'==user.userloginid}">
							<li onclick="window.location.href='/identity/index.action?flag=true'">
								<div class="htgl">
									<font style="margin-left: 35px;">管理后台</font>
								</div>
							</li>
							<li onclick="window.location.href='${basePath}/s/uc/shmy/i?type=ls'">
								<div class="htgl">
									<font style="margin-left: 35px;">教师站点</font>
								</div>
							</li>
							<li onclick="window.location.href='${basePath}/s/uc/shmy/i?type=xs'">
								<div class="htgl">
									<font style="margin-left: 35px;">学生站点</font>
								</div>
							</li>
						</c:if>
						<li onclick="window.open('/s/uc/mh/up')">
							<div class="mmxg">
								<font style="margin-left: 35px;">密码修改</font>
							</div>
						</li>
						<li onclick="window.open('/s/uc/mh/hp')">
							<div class="txsw">
								<font style="margin-left: 35px;">头像上传</font>
							</div>
						</li>
						<li onclick="execLogout()" class="zx">
							<div>
								<font style="margin-left: 35px;">注&nbsp;&nbsp;销</font>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<!--页头-->
		<!--页面主体-->
		<div id="contentSub">
			<div class="rightMore" id="serverContent">
				<div class="tRDiv">
					<span class="tRSpan">已订阅服务</span>
					<span class="cRSpan closeSpan">关闭</span>
				</div>
				<div class="cRDiv"></div>
			</div>
			<div id="contentLeft">
				<div id="subContentDiv">
					<div class="newsbox">
						<div class="maxtitlebox">
							<div id="lib_Menubox">
								<ul>
									<li id="11" onclick="setTab('1',1,4,'leftbottom')" class="hover">
										<a>通知公告</a>
									</li>
									<li id="12" onclick="setTab('1',2,4,'righttop')">
										<a>学校新闻</a>
									</li>
								</ul>
							</div>
							<a href="${basePath}/s/uc/shmy/fdn/leftbottom" target="_blank" style="padding-right: 20px" id="newsmore">更多>></a>

							<div class="clear"></div>
						</div>
						<div class="lib_Contentbox">
							<div id="con_1_1" class="listbox">
								<iframe allowtransparency="true" frameborder="0" width="100%" height="360" scrolling="no" id="righttopnews" src="${basePath}/s/uc/shmy/index/new-leftbottom(10)"></iframe>
							</div>
							<div id="con_1_2" class="listbox" style="display: none">
								<iframe allowtransparency="true" frameborder="0" width="100%" height="600" scrolling="no" id="leftbottomnews" src="${basePath}/s/uc/shmy/index/new-righttop(10)"></iframe>
							</div>
						</div>
					</div>

					<c:if test="${type=='ls' || type == 'ld'}">
						<div class="iconTwobox">
							<div class="leftico">
								<span>
									<a class="weekdo" onclick="window.open('http://report.sada.sh.edu.cn/s/report/my008')">一周安排</a>
								</span>
								<span style="width: 36%">
									<a class="weekdo1" onclick="window.open('http://report.sada.sh.edu.cn/s/report/zbb')">值班表</a>
									<a class="weekdo2" onclick="window.open('http://116.236.134.250:8089/txl.jsp')">通讯录</a>
								</span>
							</div>
							<div class="rightico">
								<span>
									<a class="timetable" onclick="window.open('http://nurp.sada.sh.edu.cn/OperateProcessor?operate=Entity_JSKB_M&Table=Entity_JSKB&ObjDescribe=fpYHy2S6ckSJew39q8kQ356x-8Ujipd9&PopupWin=false&NewWindow=true')">教师课表</a>
								</span>
								<span style="width: 36%">
									<a class="timetable1" onclick="window.open('http://report.sada.sh.edu.cn/s/report/xl')">校历</a>
									<a class="timetable2" onclick="window.open('')">作息表</a>
								</span>
							</div>
							<div class="clear"></div>
						</div>
					</c:if>

					<c:if test="${type=='xs'}">
						<div class="iconTwobox">
							<div class="leftico">
								<span>
									<a class="weekdo" target="_blank" href="http://nurp.sada.sh.edu.cn/UIProcessor?Table=VO_WDKQHZ">考勤信息</a>
								</span>
								<span style="width: 36%">
									<a class="weekdo1" target="_blank" href="http://nurp.sada.sh.edu.cn/UIProcessor?Table=View_WDJXB">教学班</a>
									<a class="weekdo2" target="_blank" href="http://nurp.sada.sh.edu.cn/UIProcessor?Table=V_JW_WDJXJXX">奖学金</a>
								</span>
							</div>
							<div class="rightico">
								<span>
									<a class="timetable" target="_blank" href="http://nurp.sada.sh.edu.cn/OperateProcessor?operate=Entity_XSKB_M1&Table=Entity_XSKB&PopupWin=false&NewWindow=true">学生课表</a>
								</span>
								<span style="width: 36%">
									<a class="timetable1" target="_blank" href="http://report.sada.sh.edu.cn/s/report/xl">校历</a>
									<a class="timetable2" href="">作息表</a>
								</span>
							</div>
							<div class="clear"></div>
						</div>
					</c:if>
				</div>
			</div>

			<div id="contentRight">
				<div class="boxAA">
					<div class="datebox">
						<div class="year">${year}年${month}月</div>
						<div class="date">${date}日</div>
						<div class="week">${weekday}&nbsp;&nbsp;&nbsp;
							<c:if test="${'null' == zc}">
								非教学周
							</c:if>
							<c:if test="${'null' != zc}">
								第${zc}教学周
							</c:if>
						</div>
						<div class="temperature">
							<iframe allowtransparency="true" frameborder="0" width="255" height="64" scrolling="no" src="http://tianqi.2345.com/plugin/widget/index.htm?s=2&z=2&t=1&v=2&d=1&bd=0&k=&f=&q=0&e=0&a=1&c=54511&w=255&h=64&align=center"></iframe>
						</div>
					</div>
					<div class="userbox">
						<div class="usephoto" style="background: none">
							<a href="">
								<img onerror="this.src='/userinfo/user_male_portrait.png'" style="width: 110%; height: 110%; margin: -5px 0px 0px -5px" src="/userinfo/${user.userloginid }" alt="用户头像">
							</a>
						</div>
						<div class="usename">${user.username }，欢迎你！</div>
						<div class="useinfo" style="position: relative;">
							<!-- 邮件 http://116.236.134.250:8089/jsz.html
							/s/uc/mh/gotomail
							 -->
							<a class="mail" style="position: relative; cursor: pointer;" onclick="window.open('/s/uc/mh/gotomail');">
								<c:if test="${null == unReadMailNumber || 0 == unReadMailNumber }">
									<span>邮件</span>
								</c:if>
								<c:if test="${null != unReadMailNumber && 0 != unReadMailNumber }">
									<span>
										邮件(
										<span style="color: red; font-size: 12px;">${unReadMailNumber }</span>
										)
									</span>
								</c:if>
								<%-- 									<div style="width: 12px; height: 12px; position: absolute; top: -30px; left: 50px; z-index: 100; color: red;">(${unReadMailNumber })</div> --%>
							</a>
							<a class="info" style="position: relative; cursor: pointer;" onclick="window.open('/s/uc/mh/hp')">修改信息</a>
							<a class="password" style="position: relative; cursor: pointer;" onclick="window.open('/s/uc/mh/up')">修改密码</a>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				<div class="boxBB">
					<!-- 需要说明的是，这里实际上是未读消息，消息包括待办，而且目前也只做了待办这一种消息 -->
					<div class="tipbox">
						<span>您有</span>
						<!-- 待办 -->
						<c:if test="${0 == todomessagenum}">0</c:if>
						<c:if test="${0 != todomessagenum}">
							<a onclick="window.open('${basePath}/s/m/index')" style="cursor: pointer; color: red;">${null == todomessagenum?0:todomessagenum}</a>
						</c:if>
						<span>条待办，</span>

						<!-- 其他消息。比如邮件等 -->
						<c:if test="${0 == fn:length(message)}">0</c:if>
						<c:if test="${0 != fn:length(message)}">
							<span style="font-size: 14px;">${fn:length(message)}</span>
						</c:if>
						<span>条消息</span>

						<span>请及时处理！</span>
						<a id="dbmore" style="cursor: pointer; padding-right: 40px; float: right; color: #fff; text-decoration: none;" onclick="window.open('${basePath}/s/m/index')">更多&gt;&gt;</a>
					</div>
					<div class="tiplistbox">
						<ol>
							<c:set var="tipTotalIndex" value="0"></c:set>
							<c:forEach var="todomessage_one" items="${todomessage }" begin="0" end="8" varStatus="status_todomessage">
								<c:set var="tipTotalIndex" value="${status_todomessage.index }"></c:set>
								<li onmouseover="$(this).find('span').css('color','green');" onmouseout="$(this).find('span').css('color','#646464');" onclick="window.open('${todomessage_one.url}');" style="height: 25px; cursor: pointer;">
									<span>${todomessage_one.bt }</span>
								</li>
							</c:forEach>

							<c:forEach var="tMessage" items="${message }" varStatus="status_message">
								<c:if test="${(tipTotalIndex + status_message.index) <= 7 }">
									<li onmouseover="$(this).find('span').css('color','green');" onmouseout="$(this).find('span').css('color','#646464');" onclick="window.open('${tMessage.url}');" style="height: 25px; cursor: pointer;">
										<span>${tMessage.title }</span>
									</li>
								</c:if>
								<c:if test="${(tipTotalIndex + status_message.index) > 7 }">
									<li onmouseover="$(this).find('span').css('color','green');" onmouseout="$(this).find('span').css('color','#646464');" onclick="window.open('${tMessage.url}');" style="height: 25px; cursor: pointer; display: none;">
										<span>${tMessage.title }</span>
									</li>
								</c:if>
							</c:forEach>
						</ol>
					</div>
				</div>

			</div>

			<div id="contentBottom">
				<div class="subContentDiv">
					<!--第二部分 管理员推送公共服务-->
					<div class="boxB" id="serverpublic">
						<div class="boxBinner">
							<ul>
								<c:forEach var="menu" items="${mrfw }" varStatus="status_menu">
									<c:if test="${ status_menu.count<=14}">
										<li class="server" onclick="window.open('${menu.menupath}')">
											<!-- 服务ID -->
											<a class="icon">
												<img src="${basePath}/resources/images/icons/orange/${menu.tb}" onerror="this.src='${basePath}/resources/images/icons/orange/icon-01.png'" />
											</a>
											<a>
												<font style="font-weight: bold;">${menu.menuname }</font>
											</a>
										</li>
									</c:if>
									<c:if test="${ status_menu.count>14}">
										<li class="server" style="display: none;" onclick="window.open('${menu.menupath}')">
											<!-- 服务ID -->
											<a class="icon">
												<img src="${basePath}/resources/images/icons/orange/${menu.tb}" onerror="this.src='${basePath}/resources/images/icons/orange/icon-01.png'" />
											</a>
											<a>
												<font style="font-weight: bold;">${menu.menuname }</font>
											</a>
										</li>
									</c:if>
								</c:forEach>


								<!-- 只有admin能改变共用部分的内容 -->
								<c:if test="${'admin' == user.userloginid}">
									<li class="dobox serverAdd" style="border: 0px; margin-top: -5px;">
										<div class="dybox" style="cursor: pointer;" onclick="window.open('${basePath}/s/uc/se/i/${mrfwid}')">
											<a class="dy" href="#">订阅</a>
											<a class="dyicon">
												<img src="/resources/images/shmy/new/ico/dy.png" border="0" />
											</a>
										</div>
										<div class="morebox" style="cursor: pointer;" o="serverContent">
											<a class="more" href="#">更多</a>
											<a class="moreicon" href="#">
												<img src="/resources/images/shmy/new/ico/more.png" border="0" />
											</a>
										</div>
									</li>
								</c:if>
								<div class="clear"></div>
							</ul>
						</div>
					</div>
					<!--第二部分 管理员推送公共服务-->
					<!--第三部分 自定义订阅服务-->
					<div class="boxC" id="serverprivate">
						<div class="boxCinner">
							<ul>
								<c:forEach var="menu" items="${dyfw }" varStatus="status_menu">
									<c:if test="${ status_menu.count<=7}">
										<li class="server" onclick="window.open('${menu.menupath}')">
											<a class="icon">
												<img src="${basePath}/resources/images/icons/yellow/${menu.tb}" onerror="this.src='${basePath}/resources/images/icons/yellow/icon-<%=rand.nextInt(80)+10%>.png'" />
											</a>
											<a>${menu.menuname }</a>
										</li>
									</c:if>
									<c:if test="${ status_menu.count>7}">
										<li class="server" style="display: none;" onclick="window.open('${menu.menupath}')">
											<a class="icon">
												<img src="${basePath}/resources/images/icons/yellow/${menu.tb}" onerror="this.src='${basePath}/resources/images/icons/yellow/icon-<%=rand.nextInt(80)+10%>.png'" />
											</a>
											<a>${menu.menuname }</a>
										</li>
									</c:if>

								</c:forEach>

								<li class="dobox serverAdd">
									<div class="dybox" style="cursor: pointer;" onclick="window.open('${basePath}/s/uc/se/i/${dyfwid}')">
										<a class="dy">订阅</a>
										<a class="dyicon">
											<img src="/resources/images/shmy/new/ico/dy.png" border="0" />
										</a>
									</div>
									<div class="morebox" style="cursor: pointer;" o="serverContent">
										<a class="more" href="#">更多</a>
										<a class="moreicon" href="#">
											<img src="/resources/images/shmy/new/ico/more.png" border="0" />
										</a>
									</div>
								</li>
								<div class="clear"></div>
							</ul>
						</div>
					</div>
					<!--第三部分 自定义订阅服务-->
					<div class="clear"></div>
				</div>
			</div>
		</div>
		<!--页脚-->
		<div id="footbox">
			<div class="footlbox">&nbsp;&nbsp;</div>
			<div class="footrbox">© 2013 上海工艺美术职业学院 保留所有权利 [English] 网站点击量：2724317</div>
		</div>
		<!--页脚-->
	</div>
	<!-- 20161109王老板 -->
	<div id="img" style="position: absolute; z-index: 1001;">
		<div style="width: 550px;">
			<div style="width: 100%; float: left; height: 40px; line-height: 40px; font-size: 16px; background: #ff4500 none repeat scroll 0 0; border-radius: 3px 3px 0 0;">
				<span style="width: 80%; height: 40px; color: #ffffff; padding-left: 15px; float: left;">上海工艺美院文明单位创建专题</span>
				<span onclick="hiden();" style="width: 40px; height: 40px; cursor: pointer; float: right; font-size: 14px; color: #ffffff; font-weight: 600;">关闭</span>
			</div>
			<div style="width: 100%; height: 175px; float: left; background-color: #FDEFC8; border-radius: 0 0 3px 3px;">
				<a style="display: block; color: #444; margin-top: 0; text-decoration: none;" href="http://www.sada.sh.edu.cn/webDisplay/ESite/online/DisplayDetail_online.jsp?id=e97c2b63-fe20-4c90-951f-e81178a64a55" target="_blank">
					<ul style="padding: 0 20px;">
						<li style="list-style-type: none; height: 40px; line-height: 40px; border-bottom: 0.5px dotted #e2e2e2">
							<strong>· 学院校训：</strong> 立德、精艺、善美、致用。
						</li>
						<li style="list-style-type: none; height: 40px; line-height: 40px; border-bottom: 0.5px dotted #e2e2e2">
							<strong>· 学院精神 (使命)：</strong> 弘扬民族文化、传承工艺美术、引领时尚潮流。
						</li>
						<li style="list-style-type: none; height: 40px; line-height: 40px;">
							<strong>· 办学理念：</strong>学校致力于非物质文化遗产传承基地和现代设计高地建设，<br> 培养品德高尚、专业精良、知行合一的艺术设计人才。
						</li>
					</ul>
				</a>
			</div>
		</div>
	</div>
	<script language="JavaScript">
		var xPos = document.body.clientWidth - 20;
		var yPos = document.body.clientHeight / 2;
		var step = 1;
		var delay = 10;
		var height = 0;
		var Hoffset = 0;
		var Woffset = 0;
		var yon = 0;
		var xon = 0;
		var pause = true;
		var interval;
		img.style.top = yPos;
		function changePos() {
			width = document.body.clientWidth;
			height = document.body.clientHeight;
			Hoffset = img.offsetHeight;
			Woffset = img.offsetWidth;
			img.style.left = xPos + document.body.scrollLeft;
			img.style.top = yPos + document.body.scrollTop;
			if (yon) {
				yPos = yPos + step;
			} else {
				yPos = yPos - step;
			}
			if (yPos < 0) {
				yon = 1;
				yPos = 0;
			}
			if (yPos >= (height - Hoffset)) {
				yon = 0;
				yPos = (height - Hoffset);
			}
			if (xon) {
				xPos = xPos + step;
			} else {
				xPos = xPos - step;
			}
			if (xPos < 0) {
				xon = 1;
				xPos = 0;
			}
			if (xPos >= (width - Woffset)) {
				xon = 0;
				xPos = (width - Woffset);
			}
		}
		function start() {
			img.visibility = "visible";
			interval = setInterval('changePos()', delay);
		}
		start();
		img.onmouseover = function() {
			clearInterval(interval);
			interval = null;
		}
		img.onmouseout = function() {
			interval = setInterval('changePos()', delay);
		}
		function hiden() {
			document.getElementById("img").style.display = "none";
		}
	</script>
	<!-- 20161109王老板 -->
</body>
</html>
